package com.example.software.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.example.software.entity.DepartmentEntity;
import com.example.software.entity.MedicineEntity;
import com.example.software.entity.RecodeEntity;
import com.example.software.utils.PageUtils;
import com.example.software.utils.Query;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.example.software.dao.MedicinetypeDao;
import com.example.software.entity.MedicinetypeEntity;
import com.example.software.service.MedicinetypeService;


@Service
public class MedicinetypeServiceImpl extends ServiceImpl<MedicinetypeDao, MedicinetypeEntity> implements MedicinetypeService {




    @Override
    public PageUtils queryPage(Map<String, Object> params) {


        LambdaQueryWrapper<MedicinetypeEntity> wrapper = new LambdaQueryWrapper<>();


        if (params.containsKey("state")) {

            String state = (String) params.get("state");
            wrapper.like(StringUtils.isNotBlank(state), MedicinetypeEntity::getState, state);
        }


        IPage<MedicinetypeEntity> page = this.page(
                new Query<MedicinetypeEntity>().getPage(params),
                new QueryWrapper<MedicinetypeEntity>()
        );

        return new PageUtils(page);
    }

}